package cn.iocoder.yudao.module.system.dal.mysql.copying;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.copying.CopyingDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.copying.vo.*;

/**
 * 文案 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CopyingMapper extends BaseMapperX<CopyingDO> {

    default PageResult<CopyingDO> selectPage(CopyingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CopyingDO>()
                .betweenIfPresent(CopyingDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(CopyingDO::getName, reqVO.getName())
                .eqIfPresent(CopyingDO::getContent, reqVO.getContent())
                .eqIfPresent(CopyingDO::getType, reqVO.getType())
                .eqIfPresent(CopyingDO::getFrequency, reqVO.getFrequency())
                .orderByDesc(CopyingDO::getId));
    }

}